const webpack = require('webpack');
const base = require('./webpack.base.js');

let nodeModules = {};

fs.readdirSync('node_modules')
    .filter((x) => {
        return ['.bin'].indexOf(x) === -1;
    })
    .forEach((mod) => {
        nodeModules[mod] = 'commonjs ' + mod;
    });

let config = {
	target: 'node',
	cache: true,
	context: __dirname,
     node: {
        __filename: false,
        __dirname: false
     },
     externals: nodeModules,
     entry: [
        'webpack/hot/poll?1000',
        './app.js'
     ],
     output: {
        path: path.resolve(__dirname, 'build'),
        filename: 'bundle.js'
     },
     resolve: {
        extensions: ['', '.js', '.json']
     }
}